@import '../../style/_variables.less';

.mooli-tab {
  position: relative;
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  padding: 0 @padding-base;
  color: @tab-text-color;
  font-size: @tab-font-size;
  line-height: @tab-line-height;
  cursor: pointer;
  &--text {
    &--ellipsis {
      display: -webkit-box;
      overflow: hidden;
      -webkit-line-clamp: 1;
      -webkit-box-orient: vertical;
    }
  }
  &--active {
    color: @tab-active-text-color;
    font-weight: @font-weight-bold;
  }

  &--disabled {
    color: @tab-disabled-text-color;
    cursor: not-allowed;
  }

  &--text {
    &--ellipsis {
      display: -webkit-box;
      overflow: hidden;
      -webkit-line-clamp: 1;
      -webkit-box-orient: vertical;
    }
  }

  &--text-wrapper {
    position: relative;
  }
  &-pane {
    flex-shrink: 0;
    box-sizing: border-box;
    width: 100%;
  }
  &-pane.hidden {
    height: 0;
    overflow: visible;
  }
}

.mooli-tabs {
  position: relative;

  &--wrap {
    overflow: hidden;

    &--scrollable {
      .mooli-tab {
        flex: 1 0 auto;
        padding: 0 @padding-sm;
      }

      .mooli-tabs--nav {
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;

        &::-webkit-scrollbar {
          display: none;
        }
      }
    }

    &--page-top {
      position: fixed;
    }

    &--content-bottom {
      top: auto;
      bottom: 0;
    }
  }

  &--nav {
    position: relative;
    display: flex;
    background-color: @tabs-nav-background-color;
    user-select: none;

    &--line {
      box-sizing: content-box;
      height: 100%;
      padding-bottom: 15px; /* 15px padding to hide scrollbar in mobile safari */
    }

    &--complete {
      padding-right: @padding-xs;
      padding-left: @padding-xs;
    }

    &--card {
      box-sizing: border-box;
      height: @tabs-card-height;
      margin: 0 @padding-md;
      border: @border-width-base solid @tabs-default-color;
      border-radius: @border-radius-sm;

      .mooli-tab {
        color: @tabs-default-color;
        border-right: @border-width-base solid @tabs-default-color;

        &:last-child {
          border-right: none;
        }

        &.mooli-tab--active {
          color: @white;
          background-color: @tabs-default-color;
        }

        &--disabled {
          color: @tab-disabled-text-color;
        }
      }
    }
  }

  &--horizontal &--underline {
    position: absolute;
    bottom: 16px;
    left: 0;
    z-index: 1;
    width: @tabs-bottom-bar-width;
    height: @tabs-bottom-bar-height;
    background-color: @tabs-bottom-bar-color;
    border-radius: @tabs-bottom-bar-height;
  }

  &--track {
    position: relative;
    display: flex;
    width: 100%;
    height: 100%;
    will-change: left;
  }

  &--content {
    &--animated {
      overflow: hidden;
    }
    &--vertical {
      display: block;
      .mooli-tabs--track {
        display: block;
      }
      .mooli-tab-pane {
        height: 100%;
      }
    }
  }

  &--line {
    .mooli-tabs--wrap {
      height: @tabs-line-height;
    }
  }

  &--card {
    > .mooli-tabs--wrap {
      height: @tabs-card-height;
    }
  }

  &--vertical {
    display: flex;
    flex-direction: row;
    height: 100%;
    .mooli-tab {
      padding: 12px 0;
    }
    .mooli-tabs--nav {
      display: block;
    }
    .mooli-tabs--wrap {
      height: auto;
    }
    .mooli-tabs--content {
      flex: 1;
    }
  }
  &--vertical &--underline {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 1;
    width: @tabs-bottom-bar-height;
    height: @tabs-bottom-bar-width;
    background-color: @tabs-bottom-bar-color;
    border-radius: @tabs-bottom-bar-width;
  }
}
